#include<bits/stdc++.h>
using namespace std;
const int maxn=200005;
struct Node{
	bool a,x=1;
}aa[maxn];
int n,s=0;
bool a,x=1;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>aa[i].a;
	}
	while(s!=n){
		x=1;
		for(int i=1;i<=n;i++){
			if(aa[i].x&&x){
				printf("%d ",i);
				s++;
				aa[i].x=0;
				a=aa[i].a;
				x=0;
				continue;
			}
			if(aa[i].a!=a&&aa[i].x==1){
				printf("%d ",i);
				s++;
				aa[i].x=0;
				a=aa[i].a;
			}
		}
		cout<<endl;
	}
	return 0;
}
